import React,{Component,PureComponent,useMemo} from 'react'

class Num extends PureComponent {
    render(){
        console.log('update')
        let {count} = this.props
        return (
            <div>{count}</div>
        )
    }
}

// const Show = ({count})=>{
//     const count2 = useMemo(()=>{
//         console.log('count--改变')
//         return count
//     },[count])
    
//     return (
//         <div>{count2}</div>
//     )
// }

export default class Count extends Component {

    constructor(props){
        super(props)
        this.state = {
            count:0,
            noRely :'noRely'
        }
    }

    onClick = ()=>{
        this.setState({
            count:this.state.count + 1
        })
    }

    render(){
        let {count,noRely} = this.state
        return (
            <div>
                <button onClick={ ()=> this.onClick() }>++</button>
                <Num count={noRely}></Num>
            </div>
        )
    }
}

